home *** CD-ROM | disk | FTP | other *** search
- #include <stdlib.h>
- #include <proto/intuition.h>
- #include <intuition/intuition.h>
- #include <proto/exec.h>
- #include <proto/graphics.h>
-
- #include "jumpwin.h"
-
- extern struct IntuitionBase *IntuitionBase;
- extern struct GfxBase *GfxBase;
- extern struct Library *GadToolsBase;
-
- main()
- {
- struct IntuiMessage *msg;
- struct Window *win[2];
- struct TextFont *font=NULL;
-
- int a;
- int run=1;
-
- win[0]=OpenWindowTags(NULL,
- WA_Left,0,WA_Top,20,
- WA_Width,300,WA_Height,100,
- WA_Title,"Window 1",
- WA_IDCMP,BUTTONIDCMP|IDCMP_CLOSEWINDOW|SLIDERIDCMP|
- IDCMP_NEWSIZE|IDCMP_REFRESHWINDOW,
- WA_Flags,WFLG_SIZEGADGET|WFLG_DRAGBAR|WFLG_DEPTHGADGET
- |WFLG_SIMPLE_REFRESH
- |WFLG_CLOSEGADGET|WFLG_ACTIVATE,
- WA_MinWidth,300,WA_MinHeight,100,
- WA_MaxWidth,-1,WA_MaxHeight,-1,
- TAG_DONE );
-
- win[1]=OpenWindowTags(NULL,
- WA_Left,320,WA_Top,50,
- WA_Width,300,WA_Height,150,
- WA_Title,"Window 2",
- WA_IDCMP,BUTTONIDCMP|IDCMP_CLOSEWINDOW|SLIDERIDCMP|
- IDCMP_NEWSIZE|IDCMP_REFRESHWINDOW,
- WA_Flags,WFLG_SIZEGADGET|WFLG_DRAGBAR|WFLG_DEPTHGADGET
- |WFLG_SIMPLE_REFRESH
- |WFLG_CLOSEGADGET|WFLG_ACTIVATE,
- WA_MinWidth,300,WA_MinHeight,100,
- WA_MaxWidth,-1,WA_MaxHeight,-1,
- TAG_DONE );
-
- if(!win[0] || !win[1]) {
- if(win[0]) CloseWindow(win[0]);
- if(win[1]) CloseWindow(win[1]);
- exit(EXIT_FAILURE);
- }
-
- if(GG_SmartRenderGui(win[0],&JumpGui,&font)) {CloseWindow(win[0]);exit(0);}
-
- while(run) {
- Wait((1<<win[0]->UserPort->mp_SigBit)|
- (1<<win[1]->UserPort->mp_SigBit));
-
- for(a=0;a<2;a++) {
-
- if(win[a]==JumpGui.Window) {
-
- while(msg=GG_GetIMsg(win[a]->UserPort)) {
-
- switch(msg->Class) {
- case IDCMP_CLOSEWINDOW: run=0;
- break;
- case IDCMP_NEWSIZE: GG_ResizeGui(&JumpGui);
- break;
- case IDCMP_REFRESHWINDOW:
- GG_BeginRefresh(&JumpGui);
- GG_RefreshGui(&JumpGui);
- GG_EndRefresh(&JumpGui,TRUE);
- break;
- case IDCMP_GADGETUP:
-
- switch(GetGadget(msg)->GadgetID) {
- case WIN0: GG_StopGui(&JumpGui);
- GG_SmartRenderGui(win[0],&JumpGui,&font);
- GG_ClearWindow(win[1]);
- break;
- case WIN1: GG_StopGui(&JumpGui);
- GG_SmartRenderGui(win[1],&JumpGui,&font);
- GG_ClearWindow(win[0]);
- break;
- case OK:
- case CANCEL: run=0;
- break;
- case FORGET:
- GG_FreeGui(&JumpGui);
- GG_SmartRenderGui(win[a],&JumpGui,&font);
- break;
- }
- break;
- }
- }
- GG_ReplyIMsg(msg);
- } else {
- while(msg=(void *)GetMsg(win[a]->UserPort)) ReplyMsg((void *)msg);
- }
-
- }
- }
-
- GG_FreeGui(&JumpGui);
-
- CloseWindow(win[0]);
- CloseWindow(win[1]);
- if(font) CloseFont(font);
- return(0);
- }
-
-
-
-